﻿namespace MvcXRepairAdmin.Services
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using MvcXRepairAdmin.Interfaces;
    using MvcXRepairAdmin.Repository.SQL;
    using XRepair.Models;

    public class CityService : ICityService
    {
        private CityDAO _cityRepository;

        public CityService()
        {
            _cityRepository = new CityDAO();
        }

        public IEnumerable<City> GetAllActiveCities()
        {
            return _cityRepository.GetAllActiveCities();
        }

        public bool DeactivateCityByID(int cityId)
        {
            return _cityRepository.DeactivateCityByID(cityId);
        }

        public bool AddNewCity(City city)
        {
            city.CreatedAt = DateTime.Now;
            return _cityRepository.AddNewCity(city);
        }

        public bool UpdateCity(City city)
        {
            city.LastUpdatedAt = DateTime.Now;
            return _cityRepository.UpdateCity(city);
        }
    }
}
